package com.minelx.statementplus.ui.form.swing;

import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.function.Consumer;

public class OnClosingDialog extends JDialog {
	public OnClosingDialog(Window owner, Consumer<WindowEvent> onClosing) {
		super(owner, "", ModalityType.APPLICATION_MODAL);

		addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent e) {
				onClosing.accept(e);
			}
		});
	}
}
